<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scale">
    <title>弹出框</title>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <style>
        #view{
            width: 300px;
            height: 100px;
            border: 1px solid red;
        }
    </style>
</head>
<body style="margin:200px;">
<div id="view">
    <button id="b" class="btn btn-danger btn-lg"
            data-toggle="popover" title="bootstrap"
            data-content="在Bootstrap 四周岁之际,Bootstrap 团队发布了 Bootstrap 4 alpha 版。我们在一周之内将所有的英文文档翻译成中文,希望能帮助中国的开发者。"
            data-placement="right">
        点击弹出/隐藏弹出窗
    </button>
</div>

<button id="btn">按钮</button>

<script>
    $('button').popover({
        viewport:{
            selector:'#view',
            padding:10
        }
    });

    $('#btn').on('click',function(){
        $('#b').popover('toggle');
        //$('#b').popover('destroy');
    });

    $('#b').on('show.bs.tab',function(){
        alert('show');
    });
</script>
</body>
</html>